package f.f0.j;

import f.f0.l.a;
import f.f0.l.b;
import f.f0.l.c;
import f.f0.l.e;
import f.v;
import f.w;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Nullable;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.X509TrustManager;

/* compiled from: Platform */
public class f {
    public static final f a;
    public static final Logger b = Logger.getLogger(v.class.getName());

    /* JADX WARNING: Missing exception handler attribute for start block: B:4:0x000d */
    /* JADX WARNING: Failed to process nested try/catch */
    /* JADX WARNING: Can't wrap try/catch for region: R(2:4|5) */
    /* JADX WARNING: Missing block: B:5:?, code skipped:
            r4 = java.lang.Class.forName("org.apache.harmony.xnet.provider.jsse.SSLParametersImpl");
     */
    /* JADX WARNING: Missing block: B:18:0x0061, code skipped:
            r0 = null;
     */
    /* JADX WARNING: Missing block: B:27:0x008c, code skipped:
            if (r0 != null) goto L_0x0104;
     */
    static {
        /*
        r0 = byte[].class;
        r1 = 0;
        r2 = 0;
        r3 = 1;
        r4 = "com.android.org.conscrypt.SSLParametersImpl";
        r4 = java.lang.Class.forName(r4);	 Catch:{ ClassNotFoundException -> 0x000d }
    L_0x000b:
        r6 = r4;
        goto L_0x0014;
    L_0x000d:
        r4 = "org.apache.harmony.xnet.provider.jsse.SSLParametersImpl";
        r4 = java.lang.Class.forName(r4);	 Catch:{ ClassNotFoundException -> 0x0061 }
        goto L_0x000b;
    L_0x0014:
        r7 = new f.f0.j.e;	 Catch:{ ClassNotFoundException -> 0x0061 }
        r4 = "setUseSessionTickets";
        r5 = new java.lang.Class[r3];	 Catch:{ ClassNotFoundException -> 0x0061 }
        r8 = java.lang.Boolean.TYPE;	 Catch:{ ClassNotFoundException -> 0x0061 }
        r5[r2] = r8;	 Catch:{ ClassNotFoundException -> 0x0061 }
        r7.m4767init(r1, r4, r5);	 Catch:{ ClassNotFoundException -> 0x0061 }
        r8 = new f.f0.j.e;	 Catch:{ ClassNotFoundException -> 0x0061 }
        r4 = "setHostname";
        r5 = new java.lang.Class[r3];	 Catch:{ ClassNotFoundException -> 0x0061 }
        r9 = java.lang.String.class;
        r5[r2] = r9;	 Catch:{ ClassNotFoundException -> 0x0061 }
        r8.m4767init(r1, r4, r5);	 Catch:{ ClassNotFoundException -> 0x0061 }
        r4 = "GMSCore_OpenSSL";
        r4 = java.security.Security.getProvider(r4);	 Catch:{ ClassNotFoundException -> 0x0061 }
        if (r4 == 0) goto L_0x0037;
    L_0x0036:
        goto L_0x003c;
    L_0x0037:
        r4 = "android.net.Network";
        java.lang.Class.forName(r4);	 Catch:{ ClassNotFoundException -> 0x003e }
    L_0x003c:
        r4 = 1;
        goto L_0x003f;
    L_0x003e:
        r4 = 0;
    L_0x003f:
        if (r4 == 0) goto L_0x0058;
    L_0x0041:
        r4 = new f.f0.j.e;	 Catch:{ ClassNotFoundException -> 0x0061 }
        r5 = "getAlpnSelectedProtocol";
        r9 = new java.lang.Class[r2];	 Catch:{ ClassNotFoundException -> 0x0061 }
        r4.m4767init(r0, r5, r9);	 Catch:{ ClassNotFoundException -> 0x0061 }
        r5 = new f.f0.j.e;	 Catch:{ ClassNotFoundException -> 0x0061 }
        r9 = "setAlpnProtocols";
        r10 = new java.lang.Class[r3];	 Catch:{ ClassNotFoundException -> 0x0061 }
        r10[r2] = r0;	 Catch:{ ClassNotFoundException -> 0x0061 }
        r5.m4767init(r1, r9, r10);	 Catch:{ ClassNotFoundException -> 0x0061 }
        r9 = r4;
        r10 = r5;
        goto L_0x005a;
    L_0x0058:
        r9 = r1;
        r10 = r9;
    L_0x005a:
        r0 = new f.f0.j.a;	 Catch:{ ClassNotFoundException -> 0x0061 }
        r5 = r0;
        r5.m7737init(r6, r7, r8, r9, r10);	 Catch:{ ClassNotFoundException -> 0x0061 }
        goto L_0x0062;
    L_0x0061:
        r0 = r1;
    L_0x0062:
        if (r0 == 0) goto L_0x0066;
    L_0x0064:
        goto L_0x0104;
    L_0x0066:
        r0 = "okhttp.platform";
        r0 = java.lang.System.getProperty(r0);
        r4 = "conscrypt";
        r0 = r4.equals(r0);
        if (r0 == 0) goto L_0x0076;
    L_0x0074:
        r0 = 1;
        goto L_0x0086;
    L_0x0076:
        r0 = java.security.Security.getProviders();
        r0 = r0[r2];
        r0 = r0.getName();
        r4 = "Conscrypt";
        r0 = r4.equals(r0);
    L_0x0086:
        if (r0 == 0) goto L_0x0090;
    L_0x0088:
        r0 = f.f0.j.b.n();
        if (r0 == 0) goto L_0x0090;
    L_0x008e:
        goto L_0x0104;
    L_0x0090:
        r0 = javax.net.ssl.SSLParameters.class;
        r4 = "setApplicationProtocols";
        r5 = new java.lang.Class[r3];	 Catch:{ NoSuchMethodException -> 0x00af }
        r6 = java.lang.String[].class;
        r5[r2] = r6;	 Catch:{ NoSuchMethodException -> 0x00af }
        r0 = r0.getMethod(r4, r5);	 Catch:{ NoSuchMethodException -> 0x00af }
        r4 = javax.net.ssl.SSLSocket.class;
        r5 = "getApplicationProtocol";
        r6 = new java.lang.Class[r2];	 Catch:{ NoSuchMethodException -> 0x00af }
        r4 = r4.getMethod(r5, r6);	 Catch:{ NoSuchMethodException -> 0x00af }
        r5 = new f.f0.j.c;	 Catch:{ NoSuchMethodException -> 0x00af }
        r5.m7739init(r0, r4);	 Catch:{ NoSuchMethodException -> 0x00af }
        r0 = r5;
        goto L_0x00b0;
    L_0x00af:
        r0 = r1;
    L_0x00b0:
        if (r0 == 0) goto L_0x00b3;
    L_0x00b2:
        goto L_0x0104;
    L_0x00b3:
        r0 = "org.eclipse.jetty.alpn.ALPN";
        r0 = java.lang.Class.forName(r0);	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00fa, ClassNotFoundException | NoSuchMethodException -> 0x00fa }
        r4 = "org.eclipse.jetty.alpn.ALPN$Provider";
        r4 = java.lang.Class.forName(r4);	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00fa, ClassNotFoundException | NoSuchMethodException -> 0x00fa }
        r5 = "org.eclipse.jetty.alpn.ALPN$ClientProvider";
        r10 = java.lang.Class.forName(r5);	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00fa, ClassNotFoundException | NoSuchMethodException -> 0x00fa }
        r5 = "org.eclipse.jetty.alpn.ALPN$ServerProvider";
        r11 = java.lang.Class.forName(r5);	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00fa, ClassNotFoundException | NoSuchMethodException -> 0x00fa }
        r5 = "put";
        r6 = 2;
        r6 = new java.lang.Class[r6];	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00fa, ClassNotFoundException | NoSuchMethodException -> 0x00fa }
        r7 = javax.net.ssl.SSLSocket.class;
        r6[r2] = r7;	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00fa, ClassNotFoundException | NoSuchMethodException -> 0x00fa }
        r6[r3] = r4;	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00fa, ClassNotFoundException | NoSuchMethodException -> 0x00fa }
        r7 = r0.getMethod(r5, r6);	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00fa, ClassNotFoundException | NoSuchMethodException -> 0x00fa }
        r4 = "get";
        r5 = new java.lang.Class[r3];	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00fa, ClassNotFoundException | NoSuchMethodException -> 0x00fa }
        r6 = javax.net.ssl.SSLSocket.class;
        r5[r2] = r6;	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00fa, ClassNotFoundException | NoSuchMethodException -> 0x00fa }
        r8 = r0.getMethod(r4, r5);	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00fa, ClassNotFoundException | NoSuchMethodException -> 0x00fa }
        r4 = "remove";
        r3 = new java.lang.Class[r3];	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00fa, ClassNotFoundException | NoSuchMethodException -> 0x00fa }
        r5 = javax.net.ssl.SSLSocket.class;
        r3[r2] = r5;	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00fa, ClassNotFoundException | NoSuchMethodException -> 0x00fa }
        r9 = r0.getMethod(r4, r3);	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00fa, ClassNotFoundException | NoSuchMethodException -> 0x00fa }
        r0 = new f.f0.j.d;	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00fa, ClassNotFoundException | NoSuchMethodException -> 0x00fa }
        r6 = r0;
        r6.m7740init(r7, r8, r9, r10, r11);	 Catch:{ ClassNotFoundException | NoSuchMethodException -> 0x00fa, ClassNotFoundException | NoSuchMethodException -> 0x00fa }
        r1 = r0;
        goto L_0x00fb;
    L_0x00fb:
        if (r1 == 0) goto L_0x00ff;
    L_0x00fd:
        r0 = r1;
        goto L_0x0104;
    L_0x00ff:
        r0 = new f.f0.j.f;
        r0.m4769init();
    L_0x0104:
        a = r0;
        r0 = f.v.class;
        r0 = r0.getName();
        r0 = java.util.logging.Logger.getLogger(r0);
        b = r0;
        return;
        */
        throw new UnsupportedOperationException("Method not decompiled: f.f0.j.f.m4768clinit():void");
    }

    public static List<String> b(List<w> list) {
        ArrayList arrayList = new ArrayList(list.size());
        int size = list.size();
        for (int i = 0; i < size; i++) {
            w wVar = (w) list.get(i);
            if (wVar != w.HTTP_1_0) {
                arrayList.add(wVar.a);
            }
        }
        return arrayList;
    }

    public void a(SSLSocket sSLSocket) {
    }

    public c c(X509TrustManager x509TrustManager) {
        return new a(d(x509TrustManager));
    }

    public e d(X509TrustManager x509TrustManager) {
        return new b(x509TrustManager.getAcceptedIssuers());
    }

    public void e(SSLSocketFactory sSLSocketFactory) {
    }

    public void f(SSLSocket sSLSocket, @Nullable String str, List<w> list) {
    }

    public void g(Socket socket, InetSocketAddress inetSocketAddress, int i) throws IOException {
        socket.connect(inetSocketAddress, i);
    }

    /* JADX WARNING: Missing exception handler attribute for start block: B:5:0x0015 */
    /* JADX WARNING: Failed to process nested try/catch */
    public javax.net.ssl.SSLContext h() {
        /*
        r3 = this;
        r0 = "java.specification.version";
        r0 = java.lang.System.getProperty(r0);
        r1 = "1.7";
        r0 = r1.equals(r0);
        if (r0 == 0) goto L_0x0015;
    L_0x000e:
        r0 = "TLSv1.2";
        r0 = javax.net.ssl.SSLContext.getInstance(r0);	 Catch:{ NoSuchAlgorithmException -> 0x0015 }
        return r0;
    L_0x0015:
        r0 = "TLS";
        r0 = javax.net.ssl.SSLContext.getInstance(r0);	 Catch:{ NoSuchAlgorithmException -> 0x001c }
        return r0;
    L_0x001c:
        r0 = move-exception;
        r1 = new java.lang.IllegalStateException;
        r2 = "No TLS provider";
        r1.<init>(r2, r0);
        throw r1;
        */
        throw new UnsupportedOperationException("Method not decompiled: f.f0.j.f.h():javax.net.ssl.SSLContext");
    }

    @Nullable
    public String i(SSLSocket sSLSocket) {
        return null;
    }

    public Object j(String str) {
        return b.isLoggable(Level.FINE) ? new Throwable(str) : null;
    }

    public boolean k(String str) {
        return true;
    }

    public void l(int i, String str, @Nullable Throwable th) {
        b.log(i == 5 ? Level.WARNING : Level.INFO, str, th);
    }

    public void m(String str, Object obj) {
        if (obj == null) {
            str = c.b.a.a.a.D(str, " To see where this was allocated, set the OkHttpClient logger level to FINE: Logger.getLogger(OkHttpClient.class.getName()).setLevel(Level.FINE);");
        }
        l(5, str, (Throwable) obj);
    }

    public String toString() {
        return getClass().getSimpleName();
    }
}
